package com.frame.database;

import java.io.Serializable;
import java.util.List;
import java.util.Map;
import com.frame.database.operate.JdbcDao;
import com.frame.database.operate.JdbcService;
import com.frame.database.util.ConditionMap;

/**
 * @Title: 系统
 * @Description:
 * @Copyright: Copyright (c) 2015
 * @Company:
 * @author 王海锋
 * @CreatedTime:2015-6-26 上午09:29:46
 * @version 1.0
 */

abstract public class JBaseService<T> implements JdbcService{

    private T daoObject;

    public T getDao(){
        return daoObject;
    }
    public static <C> C getInstance(Class<C> clazz){
        return (C)JServiceFactory.createJServiceProxy(clazz);
    }

    public List<JdataBean> query(ConditionMap paramMap) throws Exception{
        return ((JdbcDao)getDao()).query(paramMap);
    }
    public JdataBean getBean(Serializable keyid) throws Exception{
        return ((JdbcDao)getDao()).getBean(keyid);
    }
    public void del(Serializable keyid) throws Exception{
        ((JdbcDao)getDao()).del(keyid);
    }
    public void save(Map dataMap) throws Exception{
        ((JdbcDao)getDao()).save(dataMap);
    }
    public void update(Map updateMap,Map keyMap) throws Exception{
        ((JBaseDao)getDao()).update(updateMap,keyMap);
    }
    public PageResult queryPage(ConditionMap paramMap,int pageSize,int pageNo) throws Exception{
        return ((JdbcDao)getDao()).queryPage(paramMap, pageSize, pageNo);
    }

}
